//
// Created by ap on 2021/5/21.
//

#include "EventManager.h"

void EventManager::addEvent(EventEnum eventEnum, void* event, void* sender) {
    if(event == nullptr || sender == nullptr) {
        return;
    }
    EventData eventData;
    eventData.eventPointer = event;
    eventData.sender = sender;

    eventMap.insert(std::pair<EventEnum, EventData>(eventEnum, eventData));
}


EventData EventManager::getEventData(EventEnum eventEnum)
{
    EventData eventData;
    eventData.eventPointer = nullptr;
    eventData.sender = nullptr;
    std::map<EventEnum, EventData>::iterator it;

    it = eventMap.find(eventEnum);
    if (it != eventMap.end()) {
        eventData = it->second;
    }

    if(eventData.eventPointer == nullptr)
    {
    }

    return eventData;
}